#ifndef __Actor_H__
#define __Actor_H__

#include <string>
#include "Ogre.h"

//class TitleCanvas;
//class TerrainDecal;

class InputManager;

/**
* An 'Actor' is a generic 3D character that can walk the terrain. It is used as the visible 
* representation of a 'Player' in the client.
*/

class Actor
{
	std::string name;
	Ogre::SceneManager *sceneMgr;
	Ogre::Entity *entity;
	Ogre::SceneNode *baseNode, *meshNode;
	Ogre::AnimationState *idle, *walk, *fight;
	Ogre::RaySceneQuery *rayQuery;
	Ogre::Vector3 walkTarget;
	Ogre::Real walkSpeed;
	Ogre::Real stepDistance;
	bool isWalking;
	/*TitleCanvas* titleCanvas;*/
	std::string title;
	unsigned int displayMS;
	Ogre::Timer timer;
	unsigned long lastMessageTime;

	void clampToTerrain();
public:
	/**
	* Creates an Actor.
	*
	* @param	name	The unique name of the actor.
	* @param	meshName	The mesh to use.
	* @param	matName		The material to use.
	* @param	position	The initial position of the actor.
	* @param	idleAni		The name of the mesh's idle animation.
	* @param	walkAni		The name of the mesh's walk animation.
	* @param	fightAni	The name of the mesh's fight animation.
	* @param	stepDistance	The distance in world units that the actor moves in one step.
	* @param	sceneMgr	The active scene manager.
	*/
	Actor( void );

	/**
	* Destroys this actor.
	*/
	~Actor();

	///**
	//* Activates the title for this actor.
	//*
	//* @param	titleCanvas		The TitleCanvas to use
	//* @param	title			The title of this actor
	//*/
	//void displayTitle(TitleCanvas* titleCanvas, const std::string& title);

	///**
	//* If the actor has an active title, makes the actor display a message next
	//* to its title.
	//*/
	//void say(const std::string& message);

	/**
	* Scales the actor by some factor.
	*
	* @param	multiplier	The factor to scale by
	*/
	void scale(Ogre::Real multiplier);

	/**
	* Rotates the actor to face a certain point in the world.
	*
	* @param	point	The point the actor should face
	*
	* @return	The distance to the point
	*/
	Ogre::Real facePoint(const Ogre::Vector3 &point);

	/**
	* Makes the actor begin walking to a certain point in the world by a certain duration.
	*
	* @param	point	The point that the actor should walk to.
	* @param	durationSecs	The duration in seconds that the actor has to walk to the point.
	*/
	void walkTo(const Ogre::Vector3 &point, Ogre::Real durationSecs);

	void update(Ogre::Real deltaTimeSecs);

	Ogre::SceneNode* getBaseNode();

	std::string getName();

	std::string getTitle();
};

#endif